// models/ItemLabel.js
module.exports = (sequelize, DataTypes) => {
    const ItemLabel = sequelize.define('ItemLabel', {
        id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, comment: '标签 ID' },
        name: { type: DataTypes.STRING, allowNull: false, comment: '标签名称' },
        color: { type: DataTypes.STRING, allowNull: true, comment: '标签颜色（可选）' },
        sort: { type: DataTypes.INTEGER, defaultValue: 0, comment: '排序值，越小越靠前' },
        categoryId: {
            type: DataTypes.INTEGER,
            allowNull: false,
            defaultValue: 1,
            comment: '所属分类ID',
        }
    }, {
        tableName: 'item_labels',
        timestamps: true,
        paranoid: true,
        deletedAt: 'deleted_at',
        underscored: true,
        charset: 'utf8mb4',
        collate: 'utf8mb4_general_ci',
        comment: '商品标签表',
    });

    return ItemLabel;
};
